package model;

public class Graph {

    private final int[][] t;
    private final int size;

    public Graph(int[][] t, int size) {
        this.t = t;
        this.size = size;
    }

    public int get(int i, int j) {
        if (j > i)
            return t[j][i];
        else
            return t[i][j];
    }

    public int getSize() {
        return size;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < size; i++) {
            for (int j = 0; j < size; j++) {
                if (i == j) 
                    sb.append("x   ");
                else {
                    int val = get(i, j);
                    if(val < 10) {
                        sb.append(get(i, j) + "   ");
                    }
                    else if(val < 100) {
                        sb.append(get(i, j) + "  ");
                    }
                    else {
                        sb.append(get(i, j) + " ");
                    }                  
                }
            }
            sb.append("\n");
        }
        return sb.toString();
    }

}
